package com.example.hblog.module.service.serviceImpl;

import com.example.hblog.module.dao.ImageDao;
import com.example.hblog.module.pojo.Image;
import com.example.hblog.module.service.ImageService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Service
@Transactional
public class ImageServiceImpl implements ImageService {

    @Autowired
    private ImageDao imageDao;

    @Override
    public void addImg(Image image) {
        imageDao.addImg(image);
    }

    @Override
    public void deleteimg(String blogid) {
        imageDao.deleteimg(blogid);
    }

    @Override
    @Transactional(propagation = Propagation.SUPPORTS)
    public List<Image> findImgByID(String blogid) {
        return imageDao.findImgByID(blogid);
    }

    @Override
    public void deleteimgNow(String image) {
        imageDao.deleteimgNow(image);
    }


}
